import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
// main.js
//...
import pinia from './store/index' // 引入pinia

// import emitter from './utils/emitter'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import VxeUIAll from 'vxe-pc-ui'
import 'vxe-pc-ui/lib/style.css'
import VxeUITable from 'vxe-table'
import 'vxe-table/lib/style.css'
import './permission.ts'
// if you just want to import css
import 'element-plus/theme-chalk/dark/css-vars.css'
import '@/styles/index.scss'
import 'amfe-flexible' // 动态设置 html
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

const app = createApp(App)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

import 'vue-virtual-scroller/dist/vue-virtual-scroller.css' // 引入它的 css
import VueVirtualScroller from 'vue-virtual-scroller' // 引入
app.use(VueVirtualScroller) // use
app.use(router)
app.use(pinia)

app.use(ElementPlus)
app.use(VxeUIAll)
app.use(VxeUITable)

// 主题色设置
// document.documentElement 是全局变量时
const el = document.documentElement
// const el = document.getElementById('xxx')

// 获取 css 变量
getComputedStyle(el).getPropertyValue(`--el-color-primary`)

// 设置 css 变量
el.style.setProperty('--el-color-primary', 'red')
app.mount('#app')
